<template>
  <!-- v-loading="true" -->
  <div class="">

    <pageTable :tableData="tableData" :tableInit="params.tableInit" @sizeChange="sizeChange"
      @currentChange="currentChange" @exportFn="exportExcel" v-loading="loading" @pageAdd="openDrawer('add')">
      <template #operation="{ row }">
        <el-button type="primary" link @click="openDrawer('redact', row)">编辑</el-button>
        <template v-if="row.sysUserId != 1">
          <el-popconfirm title="确认要删除吗?" @confirm="delData(row.sysUserId)">
            <template #reference>
              <el-button type="danger" link>删除</el-button>
            </template>
          </el-popconfirm>
        </template>

      </template>



    </pageTable>




    <Drawer ref="DrawerRef" :title="DrawerType" @submit="DrawerSubmit" @onClose="onDrawerClose" :formConfig="IformConfig">
    </Drawer>
  </div>
</template>

<script setup lang="ts">
import pageTable from "@/components/base-ui/page-table";

import Drawer from "@/components/base-ui/drawer";

import { formConfig } from "./config/form.config";


import { tableInit } from "./config/administrators.config";

import { usepageTable } from '@/components/base-ui/page-table/usePageTable'
import { getSelpage, addauth, delinfo, updateauth } from "@/api/home"

const emit = defineEmits(["compile"]);


const {
  exportExcel,
  tableData,
  getData,
  params,
  loading,
  sizeChange,
  currentChange,
  delData,
  DrawerRef,
  openDrawer,
  DrawerSubmit,
  onDrawerClose,
  DrawerType,
  IformConfig
} = usepageTable({
  tableInit,
  getRes: getSelpage,
  addRes: addauth,
  delRes: delinfo,
  updateRes: updateauth,
  xlsxName: '管理员管理.xlsx',
  formConfig
})

getData()




</script>

<style scoped></style>
